<template>
	<view>
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="content">{{title}}</block>
		</cu-custom>
		<view class="p-4 bg-white">
			<mp-html :content="content" selectable class="text-wrap content"></mp-html>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			title:'',
			content: ''
		};
	},
	onLoad(options) {
		let url = 'Article/getContent';
		if (options.alias) {
			url = 'Article/getContentByAlias';
		}
		this.$utils.$http.get(url, {
			data: {
				id: options.id,
				alias: options.alias
			}
		}).then((res) => {
			if (res.code === this.$utils.$http.ResponseCode.SUCCESS) {
				this.$utils.$page.title(res.data.title);
				this.title = res.data.title;
				this.content = res.data.content;
			} else {
				uni.showModal({
					title: '提示',
					content: res.msg,
					showCancel: false,
					success:()=>{
						this.$utils.$page.back();
					}
				})
			}
		})
	}
}
</script>

<style lang="scss">
.content ._img {
	max-width: 100%;
}
</style>
